package com.blog.video.controller;

import com.blog.video.dto.response.Result;
import com.blog.video.util.HttpClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.text.ParseException;
import java.util.HashMap;
import java.util.Map;

@RestController
public class HikvisionController {

    @PostMapping("/api/get")
    public Result get() {
        String url = "/api/resource/v1/encodeDevice/get?pageNo=1&pageSize=10";
        try {
            HttpClient httpClient = new HttpClient(url);
            httpClient.setHttps(true);
            httpClient.post();
            String content = httpClient.getContent();
            return Result.ok(content);
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error();
        }
    }
}
